package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmintype;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPay;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPayType;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsAdminMapper extends BaseMapper<ScsAdmin> {
    //查询所有管理员信息
    @Select("select * from scs_admin where a_name like #{name}")
    @Results({
            @Result(id=true,column = "a_id",property = "aId"),
            @Result(column = "a_name",property = "aName"),
            @Result(column = "a_sex",property = "aSex"),
            @Result(column = "a_age",property = "aAge"),
            @Result(column = "a_phone",property = "aPhone"),
            @Result(column = "a_state",property = "aState"),
            @Result(column = "a_type",property = "type",javaType = com.chinadci.smartcommunitysystembackstage.entity.ScsAdmintype.class,one = @One(select = "Select")),
    })
    List<ScsAdmin> Find(String name);

    @Select("select * from scs_admintype where t_id=#{t_id}")
    ScsAdmintype Select(int id);

    //修改管理员信息查询管理员信息
    @Select("select * from scs_admin where a_id=#{id}")
    @Results({
            @Result(id=true,column = "a_id",property = "aId"),
            @Result(column = "a_name",property = "aName"),
            @Result(column = "a_sex",property = "aSex"),
            @Result(column = "a_age",property = "aAge"),
            @Result(column = "a_phone",property = "aPhone"),
            @Result(column = "a_state",property = "aState"),
            @Result(column = "a_type",property = "type",javaType = com.chinadci.smartcommunitysystembackstage.entity.ScsAdmintype.class,one = @One(select = "Select")),
    })
    List<ScsAdmin> Finds(int id);

    @Select("select * from scs_admintype where t_id=#{t_id}")
    ScsAdmintype Selects(int id);
}
